package com.hmdp;

import lombok.SneakyThrows;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author:宿世新
 * @Dte:2022/7/24
 */
public class Singleton5 implements Serializable {
    private Singleton5() {
        System.out.println("private Singleton5()");
    }

    private static class Holder {
        static Singleton5 INSTANCE = new Singleton5();
    }

    public static Singleton5 getInstance() {
        return Holder.INSTANCE;
    }


    static LocalDateTime time = LocalDateTime.now();

    @SneakyThrows
    public static void otherMethod() {
        System.out.println("otherMethod():" + LocalDateTime.now());
        Thread thread = Thread.currentThread();
        thread.sleep(5000);
    }
}